import React, { Component } from 'react';
import "../styles/List.scss";


import * as service from '../api/index'

class List extends Component {
    constructor(props) {
        super(props)
        this.state = {
            goodslist:  []
        }
    }
    async componentDidMount(){
        var res = await service.index_nav()
        console.log(res.data);
        this.setState({ goodslist: res.data.list })
        
    }
    render() {
        return (
            <div className='list'>
                {
                    this.state.goodslist.map((item, index) => {
                        return (
                            <div className='item' key={index}>
                                <img src={item.pic} alt="" />
                                <div className='name'>{item.name}</div>
                            </div>
                        )
                    })
                }
            </div>
        );
    }
}

export default List;